home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
This Disc Bytes!
/
Power Computing - The Disc 2 - This Disc Bytes.ISO
/
mac
/
CodeWarrior 7 Lite for 68K
/
MacOS Support
/
Headers
/
ANSI Headers
/
ctype.h
< prev
next >
Wrap
Text File
|
1995-08-17
|
3KB
|
95 lines
/* ctype.h standard header */
#ifndef _CTYPE
#define _CTYPE
#include <yvals.h>
#if __MWERKS__
#pragma options align=mac68k
#pragma direct_destruction off
#endif
#ifndef _STDIO
#define EOF (-1)
#endif
/* _Ctype code bits */
#define _XA 0x00 /* extra alphabetic (unused) */
#define _XS 0x00 /* extra space (unused) */
#define _BB 0x80 /* BEL, BS, etc. */
#define _CN 0x40 /* CR, FF, HT, NL, VT */
#define _DI 0x20 /* '0'-'9' */
#define _LO 0x10 /* 'a'-'z' */
#define _PU 0x08 /* punctuation */
#define _SP 0x04 /* space */
#define _UP 0x02 /* 'A'-'Z' */
#define _XD 0x01 /* '0'-'9', 'A'-'F', 'a'-'f' */
/* declarations */
extern const char *_Ctype, *_Tolower, *_Toupper;
#ifdef __cplusplus
/* inlines, for C++ */
inline int isalnum(int _C)
{return (_Ctype[_C] & (_DI|_LO|_UP|_XA)); }
inline int isalpha(int _C)
{return (_Ctype[_C] & (_LO|_UP|_XA)); }
inline int iscntrl(int _C)
{return (_Ctype[_C] & (_BB|_CN)); }
inline int isdigit(int _C)
{return (_Ctype[_C] & _DI); }
inline int isgraph(int _C)
{return (_Ctype[_C] & (_DI|_LO|_PU|_UP|_XA)); }
inline int islower(int _C)
{return (_Ctype[_C] & _LO); }
inline int isprint(int _C)
{return (_Ctype[_C] & (_DI|_LO|_PU|_SP|_UP|_XA)); }
inline int ispunct(int _C)
{return (_Ctype[_C] & _PU); }
inline int isspace(int _C)
{return (_Ctype[_C] & (_CN|_SP|_XS)); }
inline int isupper(int _C)
{return (_Ctype[_C] & _UP); }
inline int isxdigit(int _C)
{return (_Ctype[_C] & _XD); }
inline int tolower(int _C)
{return (_Tolower[_C]); }
inline int toupper(int _C)
{return (_Toupper[_C]); }
#else
/* declarations and macro overrides, for C */
_C_LIB_DECL
int isalnum(int), isalpha(int), iscntrl(int), isdigit(int);
int isgraph(int), islower(int), isprint(int), ispunct(int);
int isspace(int), isupper(int), isxdigit(int);
int tolower(int), toupper(int);
_END_C_LIB_DECL
#define isalnum(c) (_Ctype[(c)] & (_DI|_LO|_UP|_XA))
#define isalpha(c) (_Ctype[(c)] & (_LO|_UP|_XA))
#define iscntrl(c) (_Ctype[(c)] & (_BB|_CN))
#define isdigit(c) (_Ctype[(c)] & _DI)
#define isgraph(c) (_Ctype[(c)] & (_DI|_LO|_PU|_UP|_XA))
#define islower(c) (_Ctype[(c)] & _LO)
#define isprint(c) (_Ctype[(c)] & (_DI|_LO|_PU|_SP|_UP|_XA))
#define ispunct(c) (_Ctype[(c)] & _PU)
#define isspace(c) (_Ctype[(c)] & (_CN|_SP|_XS))
#define isupper(c) (_Ctype[(c)] & _UP)
#define isxdigit(c) (_Ctype[(c)] & _XD)
#define tolower(c) (_Tolower[(c)])
#define toupper(c) (_Toupper[(c)])
#endif /* __cplusplus */
#if __MWERKS__
#pragma options align=reset
#pragma direct_destruction reset
#endif
#endif /* _CTYPE */
/*
* Copyright (c) 1994 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
*/
/* Change log:
*94June04 PlumHall baseline
*94Oct07 Inserted MW changes.
*/